<?php

/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */

/**
 * Description of BUIPriceAdjust
 *
 * @author jianfeng
 */
class BUIPriceAdjust extends BUIControl {

    //handle logic under this function
    const Save_PriceAjust = 'savePriceAdjust';
    const Show_Add_PriceAdjust = 'showAddPriceAdjust';
    const Show_List_PriceAdjust = 'showListPriceAdjust';

    public function onRun($data = NULL) {
        $sender = Blyn::app()->getUIManager()->getSenderControl();
        $updateControl = Blyn::app()->getUIManager()->getUpdateControl();
        $activeLink = Blyn::app()->getUIManager()->getActiveLink();
        $theme = Blyn::app()->getUIManager()->getTheme();

        //below code used for ajust theme control
        $control = new BUIControl('priceAdjust');
        if ($theme == BUIBlyn::Theme_Mobile_Bootstrap) {
            $control = new BUIWXControl('priceAdjust');
        }

        $updateControl->addChildControl($control, 'memberControl');

        if ($sender->isAjaxLinkClicked(self::Show_ApplyFor_Membership)) {
            $control->addRenderView('applyForMember');
        }

        if ($sender->isAjaxLinkClicked(self::Show_Approve_Membership)) {
            //todo list: need check permit first
            $control->addRenderView('approveMember');
        }
    }

}
